import javax.swing.JPanel; 
import java.util.List;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JList;
import java.awt.Choice;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ArrayList;

import javax.swing.JMenu;




public class SearchUserGUI extends JPanel {
    List<User> users;
    final JComboBox comboBox;
    User usern = new User();
    int location;
    String userS;
    private JTextField textField;
    public SearchUserGUI() {
        
        setLayout(null);
        
         comboBox = new JComboBox();
        comboBox.setBounds(130, 42, 138, 23);
        add(comboBox);
        
        textField = new JTextField();
        textField.setBounds(120, 11, 320, 20);
        add(textField);
        textField.setColumns(10);
        
        JButton btnNewButton = new JButton("Search");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                userS = textField.getText();
                location = 3;
                
                
             
            }
        });
        btnNewButton.setBounds(10, 10, 89, 23);
        add(btnNewButton);
        
        
        
        JButton btnDoctorsOrders = new JButton("Edit");
        btnDoctorsOrders.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                usern = (User) comboBox.getSelectedItem();
                location = 12;
            }
        });
        btnDoctorsOrders.setBounds(10, 42, 89, 23);
        add(btnDoctorsOrders);
        
        JButton btnNewButton_1 = new JButton("Back");
        btnNewButton_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                location = -1;
            }
        });
        btnNewButton_1.setBounds(10, 266, 89, 23);
        add(btnNewButton_1);
        
        
        
        
    }
    
    public int getLoc()
    {
        return location;
    }
    public void setLoc(int i)
    {
        location = i;
    }
    
    public void setUsers(List<User> input)
    {
        users = input;
    }
    public String getUser()
    {
        return userS;
    }
    
    public User getUsern()
    {
        return usern;
    }
    
    public void work(){
    	for( int i = 0; i < users.size(); i++)
        {
            comboBox.insertItemAt(users.get(i), i);
        }
    }
}
